@extends('layouts.header')
@section('title','选择柜机')
<div class="selectGrid">
    <div class="grid">
        <div class="gridList" id="gridList">
            @foreach($grips as $grip)
            <div class="items" data-num="{{$grip->device->getId()}}">{{$grip->device->getNumber()}}</div>
            @endforeach
            <div class="kong"></div>
            <div class="kong"></div>
            <div class="kong"></div>
        </div>
    </div>
    <div class="sub">
         <button id="submit">开始使用</button>
    </div>
</div>
@push('js')
    <script>
        var obj = new MyOjb();
        function MyOjb(){
            this.grid = null;
        }
        $("#gridList .items").click(function(){
            var num = $(this).attr("data-num");
            obj.grid = num;
            $(this).addClass("active").siblings().removeClass("active");
        });

        $("#submit").click(function(){
            if (obj.grid == null || obj.grid == undefined) {
                mui.alert("请选择空闲格口", "提示", "确认");
                return false;
            } else {
                //loding 显示
                $("#isShow").show();
                $.ajax({
                    url: "",
                    type: "POST",
                    data: obj,
                    success: function(res){

                    }
                });
            }
        });
    </script>
@endpush